<template>
  <div>
    <el-input @input="handelInput" v-model="values"></el-input>
  </div>
</template>
<script setup>
import { defineEmits, ref, watch, defineProps } from "vue";
// data.otherMoney = data.otherMoney.replace(/[^0-9.]/g, "").replace(/(\..*)\./g, "$1");
const props = defineProps({
  value: {
    type: String,
    default() {
      return "";
    }
  }
});
const emits = defineEmits(["update:value"]);
const values = ref("");
const handelInput = v => {
  values.value = v.replace(/[^0-9.]/g, "").replace(/(\..*)\./g, "$1");
  emits("update:value");
};
watch(
  () => props.value,
  n => {
    values.value = n;
  },
  { deep: true ,immediate: true}
);
</script>
